How to  automate running cmdlets?
I am responsible for very basic administration of an Exchange 2007 server. I have found that I need to run cmdlets to carry out actions that used to be available in the Exchange GUI. I often find on the Internet the cmdlets I want, but then I have to go through the painstaking process of typing them in to the Exchange Management Shell. There must be an easier way. Could someone please point me in the right direction, noting that I need step by step instructions. Sorry if this question has been asked before but I have no idea of what terms to search on. Thank you.
December 21st, 2009 6:09am

On Mon, 21-Dec-09 03:09:52 GMT, Madam3181 wrote: of what terms to search on. Thank you. Enter the data into a text editor (Notepad.exe will do). Save thecontent to a file with the ".ps1" suffix.To run the script you've just created, start the EMS, change to thedirectory where you saved the script, and then enter .\script.ps1 atthe prompt.If the script refuses to run it's likely to be the execution policythat's the cause. You should be able to run "set-executionpolicy-executionpolicy RemoteSigned" to cure that.---Rich MatheisenMCSE+I, Exchange MVP--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
December 21st, 2009 7:09am

Do as Rich proposes. A good idea is to create some directory for it, such as C:\Scripts. For instance, create a text file and call it:get-mbx-stats.ps1, paste this content into it and save it. Get-MailboxStatistics | Sort-Object -Descending TotalItemSize | Select-Object DisplayName, @{ expression = {$_.TotalItemSize.Value.ToMB()}}, ItemCount | Export-Csv -NoTypeInformation -Encoding Unicode -Path c:\temp\mbx_statisitics.csv When you get more adept, consider to use a dedicated PowerShell editor, such as Quest PowerGUIhttp://www.powergui.org/index.jspa MCTS: Messaging | MCSE: S+M | Small Business Specialist
December 21st, 2009 7:19am

Thanks Rich. Sounds simple enough. Now to dare try it ;)
Free Windows Admin Tool Kit Click here and download it now
December 21st, 2009 8:42am

Thanks Jon-Alfred. I doubt there will be any adeptness here ;) Exchange 2007 is a big disappointment to low-level admins like myself. It is way to hard to use.
December 21st, 2009 8:46am

Or you can even schedule the taks to run automatically... How To: Schedule PowerShell Script for an Exchange Task http://exchangeshare.wordpress.com/2008/12/08/how-to-schedule-powershell-script-for-an-exchange-task/Amit Tank MVP: Exchange Server | MCTS: Microsoft Exchange Server 2010, Configuration | MCITP: EMA | MCSA: M Blog: http://ExchangeShare.WordPress.com | User Group: http:/MUC-UG.org.in
Free Windows Admin Tool Kit Click here and download it now
December 21st, 2009 9:18am

On Mon, 21-Dec-09 05:42:36 GMT, Madam3181 wrote:>Thanks Rich. Sounds simple enough. Now to dare try it ;) No guts, no glory.No pain, no gain.Etc.---Rich MatheisenMCSE+I, Exchange MVP--- Rich Matheisen MCSE+I, Exchange MVP
December 21st, 2009 7:32pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics